package com.sojson.project.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sojson.project.dao.GoodRecomDao;
import com.sojson.project.entity.po.GoodRecom;
import com.sojson.project.entity.vo.GoodRecomVo;
import com.sojson.project.service.GoodRecomService;

/**
 * 推荐标签表Service实现类
 * 
 * @author liu
 * @date 2021-04-07
 */
@Service
public class GoodRecomServiceImpl implements GoodRecomService {

    @Resource
    private GoodRecomDao goodRecomDaoImpl;

    /**
     * 单条插入
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(GoodRecom goodRecom) {
        int insert = goodRecomDaoImpl.insert(goodRecom);
        return insert;
    }

    /**
     * 批量插入
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(GoodRecom goodRecom) {
        int insertList = goodRecomDaoImpl.insertList(goodRecom.getGoodRecoms());
        return insertList;
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(GoodRecom goodRecom) {
        int deleteByDto = goodRecomDaoImpl.deleteByDto(goodRecom);
        return deleteByDto;
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        int countAll = goodRecomDaoImpl.countAll();
        return countAll;
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<GoodRecom> findAll() {
        List<GoodRecom> findAll = goodRecomDaoImpl.listAll();
        return findAll;
    }

    /**
     * 根据对象统计数量
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(GoodRecom goodRecom) {
        int countByDto = goodRecomDaoImpl.countByDto(goodRecom);
        return countByDto;
    }

    /**
     * 根据对象查询
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public List<GoodRecom> findByDto(GoodRecom goodRecom) {
        List<GoodRecom> findByDto = goodRecomDaoImpl.listByDto(goodRecom);
        return findByDto;
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        int deleteById = goodRecomDaoImpl.deleteById(id);
        return deleteById;
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(ArrayList<Integer> ids) {
        int deleteByIdList = goodRecomDaoImpl.deleteByIdList(ids);
        return deleteByIdList;
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(GoodRecom goodRecom) {
        int updateById = goodRecomDaoImpl.updateById(goodRecom);
        return updateById;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(GoodRecom goodRecom) {
        int updateStaticByIdList = goodRecomDaoImpl.updateStaticByIdList(goodRecom);
        return updateStaticByIdList;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(GoodRecom goodRecom) {
        int updateChangeByIdList = goodRecomDaoImpl.updateChangeByIdList(goodRecom.getGoodRecoms());
        return updateChangeByIdList;
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(GoodRecom goodRecom) {
        int updatePartialById = goodRecomDaoImpl.updatePartialById(goodRecom);
        return updatePartialById;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(GoodRecom goodRecom) {
        int updateStaticPartialByIdList = goodRecomDaoImpl.updateStaticPartialByIdList(goodRecom);
        return updateStaticPartialByIdList;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(GoodRecom goodRecom) {
        int updateChangePartialByIdList = goodRecomDaoImpl.updateChangePartialByIdList(goodRecom.getGoodRecoms());
        return updateChangePartialByIdList;
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public GoodRecom findById(Integer id) {
        GoodRecom findById = goodRecomDaoImpl.findById(id);
        return findById;
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<GoodRecom> findByIdList(ArrayList<Integer> ids) {
        ArrayList<GoodRecom> findByIdList = goodRecomDaoImpl.findByIdList(ids);
        return findByIdList;
    }

    /**
     * 通过对象查询id列表
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Integer> findIdByDto(GoodRecom goodRecom) {
        ArrayList<Integer> findIdByDto = goodRecomDaoImpl.findIdByDto(goodRecom);
        return findIdByDto;
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        goodRecomDaoImpl.clear();
    }

    /**
     * 根据对象查询
     * 
     * @param goodRecom
     * @return
     * @throws SQLException
     */
    @Override
    public List<GoodRecomVo> list(GoodRecom goodRecom) {
        return goodRecomDaoImpl.list(goodRecom);
    }

}